package com.axjy.service.impl;

import com.axjy.dto.SolvetaskMainDto;
import com.axjy.mapper.SolvetaskMainMapper;
import com.axjy.pojo.SolvetaskMain;
import com.axjy.service.SolvetaskMainService;
import com.axjy.service.vo.Pager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Created by 83536 on 2018/1/30.
 */
@Service("solvetaskMainService")
@Transactional
public class SolvetaskMainServiceImpl implements SolvetaskMainService {

    @Resource
    private SolvetaskMainMapper solvetaskMainMapper;

    @Transactional(readOnly = true)
    @Override
    public Pager searchPager(Integer offset, Integer limit, SolvetaskMainDto solvetaskMainDto) {
        Pager pager=new Pager();
        pager.setRows(solvetaskMainMapper.solveShow(offset, limit, solvetaskMainDto));
        pager.setTotal(solvetaskMainMapper.getCount(solvetaskMainDto));
        return pager;
    }
    @Transactional
    @Override
    public void add(SolvetaskMain solvetaskMain) {
        solvetaskMainMapper.add(solvetaskMain);
    }

    @Override
    public void update(SolvetaskMain solvetaskMain) {
        solvetaskMainMapper.update(solvetaskMain);
    }

    @Override
    public Pager searchPagers(Integer offset, Integer limit, SolvetaskMainDto solvetaskMainDto) {
        Pager pager=new Pager();
        pager.setRows(solvetaskMainMapper.sShow(offset,limit,solvetaskMainDto));
        pager.setTotal(solvetaskMainMapper.getCount(solvetaskMainDto));
        return pager;
    }

    @Override
    public Pager searchPagerss(Integer offset, Integer limit, SolvetaskMainDto solvetaskMainDto) {
        Pager pager=new Pager();
        pager.setRows(solvetaskMainMapper.solveShows(offset,limit,solvetaskMainDto));
        pager.setTotal(solvetaskMainMapper.getCount(solvetaskMainDto));
        return pager;
    }

    @Override
    public void updatet(Integer id) {
        solvetaskMainMapper.updatet(id);
    }

}
